partial class RO_SET_INCL{E} < $RO_SET{E}
****
Partial class for $RO_SET{E} that implements other functions in terms of has and elt!
_


Ancestors
$RO_SET{_} $STR $CONTAINER{_} $ELT{_}
$ELT COMPARE{_}

Descendants
FILTER_SET_VIEW{_} DIGRAPH_NODE_SET_VIEW{_,_} DIGRAPH_NODE_SET_VIEW{_} SET_INCL{_}
H_SET{_} SET{_} DIGRAPH_INC_SET_VIEW{_,_} DIGRAPH_OUTG_SET_VIEW{_,_}
BINOP_SET_VIEW{_}



Public


Features
as_array: ARRAY{E}
stub copy: SAME;
**** Return a copy of the set
diff(s: $RO_SET{E}): SET{E}
**** See the comment for "union" and $RO_SET::diff
diff_view(s: $RO_SET{E}): $RO_SET{E}
**** See the comment for "union_view"
equals(a:$RO_SET{E}): BOOL
**** Returns 'true' if every element of self is elt_eq to an element in 'a' and vice versa. Neither may be void.
stub has(e: E): BOOL;
**** Return true if the class has the element "e"
intersection(s:$RO_SET{E}): SET{E}
**** See the comment for "union" and $RO_SET::intersection
intersection_view(s: $RO_SET{E}): $RO_SET{E}
**** See the note for "union_view"
is_empty: BOOL
**** Do not do size=0. Finding size may require iteration through all elements - quite wasteful for just "is_empty"
is_subset_of(s: $RO_SET{E}): BOOL
**** Return true if "self" is a subset of "s"
size: INT
str: STR
**** Prints out a string version of the array of the components that are under $STR
sym_diff(s: $RO_SET{E}): SET{E}
**** See the comment for "union" and $RO_SET::sym_diff
sym_diff_view(s: $RO_SET{E}): $RO_SET{E}
**** See the comment for "union_view"
union(s: $RO_SET{E}): SET{E}
**** Union is defined by default to create a "view" and then convert that into a SET. Subtypes may redefine this behavior to return a set of type "SAME", without going through a view
union_view(s: $RO_SET{E}): $RO_SET{E}
**** Return a read-only "view" of the union of "self" and "s" The resulting view just points to the two component sets and computes its elements on-the-fly, as needed. As a result, this form of union requires almost no additional space but may it may take slightly longer to perform operations

Iters
stub elt!: E;
**** Yield the elements of the set


Private

create_from_internal(s: $RO_SET{E}): SET{E}
**** Used as an auxilliary routine by the view creation routines. When the return type can be any $RO_SET, then by default a "SET" will be constructed and used
elt_eq(e1,e2:ETP):BOOL .. Included as elt_eq
**** The "less than" relation used in the sorting routines. Compares the object "id" by default. May be redefined in descendants.
elt_hash(e:ETP):INT .. Included as elt_hash
**** A hash value associated with an element. Must have the property that if "elt_eq(e1,e2)" then "elt_hash(e1)=elt_hash(e2)". Can be defined to always return 0, but many routines will then become quadratic. Uses object "id" by default. May be redefined in descendants.
elt_lt(e1,e2:ETP):BOOL .. Included as elt_lt
**** The "less than" relation used in the sorting routines. Compares the object "id" by default. May be redefined in descendants.
elt_nil: ETP .. Included as elt_nil
**** Return the nil value. If the element is under $NIL then return e.nil. Otherwise, return void
_
get_set_of_self: SAME
is_elt_nil(e:ETP):BOOL .. Included as is_elt_nil

The Sather Home Page